<?php
/**
 * Short Description  
 *
 * Long Description 
 *
 * @category   
 * @package    
 * @subpackage 
 * @copyright 
 * @author     Sandeep Manne<sandeep.manne@costrategix.com>
 */
class Core_View_Helper_FormLabel extends Zend_View_Helper_FormLabel
{

	public function formLabel($name, $value = null, array $attribs = array())
    {
    	$info = $this->_getInfo($name, $value, $attribs);
        extract($info); // name, value, attribs, options, listsep, disable, escape
        // build the element
        if ($disable) {
            // disabled; display nothing
            return  '';
        }
        //$value = ($escape) ? $this->view->escape($value) : $value;
        $for   = (empty($attribs['disableFor']) || !$attribs['disableFor'])
               ? ' for="' . $this->view->escape($id) . '"'
               : '';
        if (array_key_exists('disableFor', $attribs)) {
            unset($attribs['disableFor']);
        }

    	$class = explode(" ", $attribs['class']);
        if (in_array("required", $class)) {
        	$value = "<font color='red'>*</font>".$value; 
        }
        
        // enabled; display label
        $xhtml = '<label'
                . $for
                . $this->_htmlAttribs($attribs)
                . '>' . $value . '</label>';
		
        return $xhtml;
    }
}